package home_8_25;

import home_8_25.view.UserView;
import home_8_25.view.impl.AdminView;
import home_8_25.view.impl.BusinessView;

import java.util.Map;
import java.util.Scanner;

public class App {
    public static void main(String[] args) {
        System.out.println("欢迎使用《饿了么》后台管理程序");
        System.out.println("请选择身份");
        System.out.println("1.管理员");
        System.out.println("2.商家");
        System.out.println("请选择");
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();


        UserView userView =null;
        BusinessView businessView = null;
        switch (n){
            case 1:
                userView = new AdminView();
                break;
            case 2:
                userView = new BusinessView();

                break;

            case 3:
                break;
            default:
                System.out.println("请输入正确指令");
        }
        if (userView==null){
            System.exit(0);

            //使用循环应该用cotinue；
        }
        Map<String,Object> map = userView.login();
        if (map!=null){
            userView.setInfo(map);
            userView.menu();
        }else {
            System.out.println("密码有误");
        }
/*        Map<String,Object> map2 = userView.login();
        if (map2!=null){
            userView.menu();

        }else {
            System.out.println("商家密码有误");
        }*/


    }
}
